package com.team.sion.controller;

import com.team.sion.common.SuccessMessage;
import com.team.sion.pojo.Song;
import com.team.sion.pojo.SongList;
import com.team.sion.service.SongListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SongListController {
    @Autowired
    private SongListService songListService;
    @RequestMapping("/songList")
    public Object songList(){
        List<SongList> list = songListService.findAll();
        return new SuccessMessage<List<SongList>>("songList",list).getMessage();
    }
    @RequestMapping("/byScore")
    public Object songListByScore(){
        List<SongList> list = songListService.findAllByScore();
        return new SuccessMessage<List<SongList>>("songList",list).getMessage();
    }
    @RequestMapping("/songList/style/detail")
    public Object songList(String style){
        List<SongList> list = songListService.findByStyle(style);
        return new SuccessMessage<List<SongList>>("songList",list).getMessage();
    }
    @RequestMapping("/songList/likeTitle/detail")
    public Object songs(String title){
        List<SongList> list = songListService.findByTitle(title);
        return new SuccessMessage<List<SongList>>("songList",list).getMessage();
    }
    @RequestMapping("/listSong/detail")
    public Object songs(Integer songListId){
        List<Song> list = songListService.findById(songListId);
        return new SuccessMessage<List<Song>>("songList",list).getMessage();
    }
    @RequestMapping("/songList/detail")
    public Object songListDetail(Integer songListId){
        List<SongList> list = songListService.findBySongListId(songListId);
        return new SuccessMessage<List<SongList>>("success",list).getMessage();
    }
}
